home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / u_man / cat1 / cvstatic.z / cvstatic
Text File  |  1998-10-30  |  18KB  |  397 lines

  1.  
  2.  
  3.  
  4. CCCCVVVVSSSSTTTTAAAATTTTIIIICCCC((((1111))))                                                        CCCCVVVVSSSSTTTTAAAATTTTIIIICCCC((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      cvstatic - static analysis tool
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ccccvvvvssssttttaaaattttiiiicccc [----bbbbaaaattttcccchhhh] [----ffffiiiilllleeeesssseeeetttt <filename>] [----rrrreeeeaaaaddddoooonnnnllllyyyy] [----eeeexxxxeeeeccccuuuuttttaaaabbbblllleeee
  13.      <filename>] [----nnnnooooiiiinnnnddddeeeexxxx] [----pppprrrreeeepppprrrroooocccceeeessssssss] [----mmmmooooddddeeee SSSSCCCCAAAANNNNNNNNEEEERRRR] [----mmmmooooddddeeee PPPPAAAARRRRSSSSEEEERRRR]
  14.  
  15. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  16.      Cvstatic is a source code analysis tool designed to help programmers
  17.      understand the structure of a program. Cvstatic allows the programmer to
  18.      ask questions about a collection of files, such as "Who calls this
  19.      function", or "Who references this variable".  Cvstatic supports C, C++,
  20.      and Fortran, and provides various ways to look at your program structure
  21.      graphically, in addition to providing textual results of queries.
  22.  
  23. GGGGEEEETTTTTTTTIIIINNNNGGGG SSSSTTTTAAAARRRRTTTTEEEEDDDD
  24.      To get started, type "cvstatic" in the directory containing the source
  25.      files you wish to analyze. You can ask queries by selecting an item of
  26.      the Queries menu. For more details on the available Queries, see the
  27.      Cvstatic manual.  Additional information on using cvstatic can also be
  28.      found below. You can also ask for on-line help by selecting an item from
  29.      the Help menu.
  30.  
  31. FFFFIIIILLLLEEEESSSSEEEETTTT FFFFIIIILLLLEEEESSSS
  32.      Cvstatic works on _s_o_u_r_c_e files, and does not require the files to
  33.      represent a complete program. Because cvstatic is very forgiving of
  34.      syntax errors, and does not require completeness, cvstatic will work on
  35.      programs that will not yet compile. This makes it useful when developing
  36.      new code as well as porting existing code to new platforms.
  37.  
  38.      Cvstatic also have a more detailed analysis mode called _p_a_r_s_e_r mode that
  39.      uses a real compiler front-end to analyze the code.  This mode works only
  40.      on sources that do compile.
  41.  
  42.      You must provide cvstatic with a set of files to analyze. Cvstatic
  43.      analyzes files found in a _f_i_l_e_s_e_t, which is just a file that contains a
  44.      list of files, one file per line. By default cvstatic creates a fileset
  45.      containing the pattern *.[cCfF], which matches all C, Fortran, and C++
  46.      programs in the current directory. (NNNNooootttteeee:::: C++ has no standard suffix
  47.      conventions, and the pattern used by cvstatic may not match c++
  48.      conventions used at your site.)  A fileset file can have any name you
  49.      like, but by default cvstatic looks for a file named _c_v_s_t_a_t_i_c._f_i_l_e_s_e_t
  50.      when it starts up.
  51.  
  52.      If the default fileset does not meet your needs, the fileset file can be
  53.      changed as needed. You can provide cvstatic with a manually-prepared list
  54.      by editing the fileset file with a text editor.  If you have many
  55.      subdirectories, you may find it useful to use the _f_i_n_d command to create
  56.      a fileset file. For example, the following command can be used to
  57.      generate a fileset containing all C files in the current directory and
  58.      all subdirectories.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. CCCCVVVVSSSSTTTTAAAATTTTIIIICCCC((((1111))))                                                        CCCCVVVVSSSSTTTTAAAATTTTIIIICCCC((((1111))))
  71.  
  72.  
  73.  
  74.      find . -name \*.c -print > cvstatic.fileset
  75.  
  76.      All fileset files must have "-cvstatic" as the first line.  If the
  77.      fileset file is created by the user outside the Static Analyzer, the user
  78.      must edit the file to add this line at the beginning.  If this line is
  79.      absent, cvstatic will fail to recognize file as a valid fileset.
  80.  
  81.      You do not need to list header files in a file set. Cvstatic determines
  82.      what headers are actually used as it reads the source files. By default,
  83.      cvstatic looks in the current directory (the directory of the including
  84.      file) and then /usr/include for all headers. If you want cvstatic to look
  85.      elsewhere, just add lines like:
  86.  
  87.           -I/usr/local/include
  88.  
  89.      to the end of the file set.
  90.  
  91.      You can also ask cvstatic to extract a fileset from an executable by
  92.      specifying -executable <filename> on the command line, or use cvstatic's
  93.      fileset editor to build a list for you.
  94.  
  95.      In scanner mode, Cvstatic creates several database files from the sources
  96.      listed in the fileset file. The names of these files are based on the
  97.      name of the fileset file. By default, these files are named
  98.      cvstatic.xref, cvstatic.index, and cvstatic.posting. These files are
  99.      non-ascii database files used by cvstatic to rapidly look up information
  100.      in response to queries.
  101.  
  102.      In parser mode, cvstatic creates a number of files beginning with "cvdb"
  103.      that compose a database of a different format from that produced in
  104.      scanner mode.  cvstatic can analyze files in either mode and will produce
  105.      both kinds of database files.
  106.  
  107.      By default, cvstatic checks the dates of all files in a fileset when it
  108.      starts up. If any files are newer than the database files, cvstatic
  109.      incrementally updates the database. This behavior can be changed in one
  110.      of two ways. Cvstatic can be started in readonly mode, by specifying a
  111.      -readonly flag on the command-line. Cvstatic can also be changed to
  112.      readonly mode interactively, by selecting the appropriate option in the
  113.      General Options dialog (brought up from the General Options... entry on
  114.      the Admin menu). You can also force the database to be completely rebuilt
  115.      at any time by choosing the Force Scan command on the Admin menu.
  116.  
  117.      Readonly mode is useful for viewing files mounted on read-only file
  118.      systems. For example, a large project might build a cvstatic database
  119.      overnight on a fileserver. Individual users could view this database by
  120.      starting cvstatic in readonly mode, without having cvstatic try to
  121.      rebuild the database. For large filesets, using readonly mode can reduce
  122.      startup time significantly, because cvstatic will not check the time
  123.      stamps on every file. Note however, that using an outofdate database may
  124.      mean that the results do not match the files.
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. CCCCVVVVSSSSTTTTAAAATTTTIIIICCCC((((1111))))                                                        CCCCVVVVSSSSTTTTAAAATTTTIIIICCCC((((1111))))
  137.  
  138.  
  139.  
  140. QQQQUUUUEEEERRRRIIIIEEEESSSS
  141.      Cvstatic supports a lengthy list of queries. Programmers can make queries
  142.      by selecting an item from the Queries menu in the main menu bar of
  143.      cvstatic.  Some queries are always available, while other queries require
  144.      a "target" argument. For example, the query: "list all functions" does
  145.      not require an argument, while "who calls <function>" does require an
  146.      argument. Queries that require an argument take their argument from the
  147.      "Query Target" text field at the top of the main cvstatic window.
  148.  
  149.      Queries are displayed in the current view, and are also recorded in the
  150.      history list to allow users to re-examine results of previous queries.
  151.  
  152. VVVVIIIIEEEEWWWWSSSS
  153.      Cvstatic offers several different ways to view the results of a query.
  154.      The default view is the text view. Other views include the Call Tree
  155.      View, the Class Tree View, and the File Dependency View.
  156.  
  157.      TTTTeeeexxxxtttt VVVViiiieeeewwww
  158.  
  159.      The Text View is the default view that appears when cvstatic is first
  160.      started. This view displays the results of each query as a list. Each
  161.      item in the list represents one result of the query. For example, if you
  162.      ask "who is called by main", you will see a list of all functions called
  163.      by the function main, along with the file in which the call occurred, (in
  164.      this case the same file as main), the line number, and a short code
  165.      segment.
  166.  
  167.      Clicking the mouse on a line in the Text View selects both a line and a
  168.      column. The text in the selected column is placed in the Query target
  169.      area for future use as a query target.  You can also double click on any
  170.      line to bring up an editor to view the source indicated by the line.
  171.  
  172.      CCCCaaaallllllll TTTTrrrreeeeeeee VVVViiiieeeewwww
  173.  
  174.      The Call Tree View displays a call graph of the functions in the fileset.
  175.      By default, the call tree displays only the functions represented by the
  176.      results of a query. For example, a query like "who is called by main" is
  177.      displayed graphically as a tree one level deep with main as the root of
  178.      the tree. Less obvious, if you display the results of a query like "who
  179.      references x", all functions that reference the variable x will be
  180.      displayed. If any of these functions have caller/callee relationships,
  181.      these will be shown as well.
  182.  
  183.      The Call Tree View supports three other display modes. In Incremental
  184.      Mode the results of all previous queries remain on the screen when new
  185.      queries are made. This allows the user to build up a call tree of an
  186.      interesting portion of code incrementally. The next mode, is to show All
  187.      Defined functions in the file set at all times. The results of various
  188.      queries are shown by annotating the appropriate nodes of the tree in
  189.      color. This mode is only appropriate for fairly small filesets. For large
  190.      numbers of functions, the tree quickly becomes unmanageable. The final
  191.      mode is to show the Complete Tree at all times. This mode is similar to
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. CCCCVVVVSSSSTTTTAAAATTTTIIIICCCC((((1111))))                                                        CCCCVVVVSSSSTTTTAAAATTTTIIIICCCC((((1111))))
  203.  
  204.  
  205.  
  206.      the All Defined mode, but displays not only all functions defined in the
  207.      file set but all known functions referenced within the fileset, including
  208.      library routines, system calls and so on.
  209.  
  210.      CCCCllllaaaassssssss TTTTrrrreeeeeeee VVVViiiieeeewwww
  211.  
  212.      The Class Tree View is used for C++ programs and allows the programmer to
  213.      see superclass/subclass relationships between classes defined within the
  214.      fileset. The Class Tree View functions similarly to the Call Tree View.
  215.  
  216.      FFFFiiiilllleeee DDDDeeeeppppeeeennnnddddeeeennnnccccyyyy VVVViiiieeeewwww
  217.  
  218.      The File Dependency View displays include relationships between files The
  219.      File Dependency Tree View functions similarly to the Call Tree View. This
  220.      view is useful for seeing how include files are used, but also can be
  221.      used to provide a global view of the system. For example, displaying the
  222.      File Dependency View and making the query "who references x" would
  223.      display all files that contains references to the variable x.
  224.  
  225. CCCCOOOOMMMMMMMMAAAANNNNDDDD LLLLIIIINNNNEEEE OOOOPPPPTTTTIIIIOOOONNNNSSSS
  226.      Cvstatic accepts the following options:
  227.  
  228.      ----bbbbaaaattttcccchhhh ----ffffiiiilllleeeesssseeeetttt [[[[ffffiiiilllleeeesssseeeetttt nnnnaaaammmmeeee]]]]
  229.           Run cvstatic in batch mode.  Batch mode is useful if you want to
  230.           build a database for a very large program and don't want to wait
  231.           while it builds.  (For example, you might run cvstatic overnight as
  232.           a "cron" job.)  The fileset file must already exist in the immediate
  233.           directory for batch mode to work.  Filename defaults to
  234.           cvstatic.fileset.  Nothing is displayed when cvstatic is run in
  235.           batch mode. When the database is built, cvstatic exits.  Batch mode
  236.           always forces a complete rebuild of the database.
  237.  
  238.           The -fileset option needs to be given if the default fileset is not
  239.           being used.
  240.  
  241.      ----rrrreeeeaaaaddddoooonnnnllllyyyy
  242.           Run cvstatic using the current database files. Do not attempt to
  243.           update the database.  The fileset file and database files must
  244.           already exist.
  245.  
  246.      ----ffffiiiilllleeeesssseeeetttt <<<<ffffiiiilllleeee>>>>
  247.           Tell cvstatic to use the given file as a fileset file instead of the
  248.           default cvstatic.fileset. Database filenames will be generated based
  249.           on the given name.
  250.  
  251.      ----pppprrrreeeepppprrrroooocccceeeessssssss
  252.           By default, cvstatic does _n_o_t preprecess files in scanner mode.
  253.           Preprocessing destroys useful information and alters the programmers
  254.           view of the program.  In general cvstatic tries to work on the
  255.           unaltered sources. However, for heavily ifdef'd code, it is
  256.           sometimes desirable to preproces ifdefs. If the -preprocess flag is
  257.           given, cvstatic will run a special preprocessor before scanning the
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. CCCCVVVVSSSSTTTTAAAATTTTIIIICCCC((((1111))))                                                        CCCCVVVVSSSSTTTTAAAATTTTIIIICCCC((((1111))))
  269.  
  270.  
  271.  
  272.           code.  This preprocessor only handles ifdefs and defines. It does
  273.           not perform macro expansion, nor insert included code. It does read
  274.           include files to look for defines that might affect other ifdefs.
  275.           Preprocessing adds significantly to the time required to generate a
  276.           scanner-mode database file.
  277.  
  278.      ----nnnnooooiiiinnnnddddeeeexxxx
  279.           By default, cvstatic creates three database files in scanner mode.
  280.           The first, cvstatic.xref contains cross reference listings. The
  281.           second two, cvstatic.index and cvstatic.posting, provide a way to
  282.           rapidly find items in the cvstatic.xref file. If the -noindex option
  283.           is specified, the index files will not be built, and cvstatic will
  284.           rely on a slower, linear search mode for all queries. The default
  285.           mode is significantly faster, particularly on large databases.
  286.           However, the index files take time to generate and require
  287.           approximately twice as much disk space as when the -noindex option
  288.           is used.
  289.  
  290.      ----eeeexxxxeeeeccccuuuuttttaaaabbbblllleeee <<<<pppprrrroooogggg>>>>
  291.           This option requests cvstatic to generate a fileset by extracting
  292.           the filenames used to build the named executable. This executable
  293.           must be unstripped. Although this may at times provide a convenient
  294.           way to create a fileset file, you will probably want to edit the
  295.           resulting fileset file, as this technique includes _a_l_l files,
  296.           including system libraries, and other files that are probably
  297.           outside the fileset of interest.
  298.  
  299.      ----mmmmooooddddeeee SSSSCCCCAAAANNNNNNNNEEEERRRR
  300.           This option limits cvstatic to operating in scanner mode.  File in
  301.           the parser-mode fileset will be ignored, and queries supported only
  302.           in parser mode will be unavailable.  A parser-mode database is not
  303.           produced.  In the absence of either -mode option, cvstatic analyzes
  304.           files in either mode and supports all queries.
  305.  
  306.      ----mmmmooooddddeeee PPPPAAAARRRRSSSSEEEERRRR
  307.           This option limits cvstatic to operating in parser mode.  File in
  308.           the scanner-mode fileset will be ignored, and queries supported only
  309.           in scanner mode will be unavailable. The files cvstatic.xref,
  310.           cvstatic.postings, and cvstatic.index are not produced.  In the
  311.           absence of either -mode option, cvstatic analyzes files in either
  312.           mode and supports all queries.
  313.  
  314. WWWWAAAARRRRNNNNIIIINNNNGGGGSSSS
  315.      Cvstatic is intended for use with a _s_i_n_g_l_e program. Attempting to analyze
  316.      filesets that represent multiple programs will produce unpredictable
  317.      results in the graphical views.
  318.  
  319.      Cvstatic performs a _s_t_a_t_i_c analysis. Therefore, it cannot do anything
  320.      reasonable with C++ virtual functions, or other indirect techniques for
  321.      calling functions.
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. CCCCVVVVSSSSTTTTAAAATTTTIIIICCCC((((1111))))                                                        CCCCVVVVSSSSTTTTAAAATTTTIIIICCCC((((1111))))
  335.  
  336.  
  337.  
  338. FFFFIIIILLLLEEEESSSS
  339.      cvstatic.fileset
  340.      cvstatic.xref
  341.      cvstatic.index
  342.      cvstatic.posting
  343.      /usr/lib/WorkShop/cvstaticpp
  344.  
  345. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  346.      Help
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.